!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("rb_wixui.thunderbolt[GoogleMap]",["react"],t):"object"==typeof exports?exports["rb_wixui.thunderbolt[GoogleMap]"]=t(require("react")):e["rb_wixui.thunderbolt[GoogleMap]"]=t(e.React)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={5329:function(t){t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.p="https://static.parastorage.com/services/editor-elements-library/dist/thunderbolt/";var r={};return function(){o.r(r),o.d(r,{components:function(){return J}});var e=o(5329);function t(e){var n,o,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;n"undefined"!=typeof window,i=e=>Object.entries(e).reduce(((e,[t,n])=>(t.includes("data-")&&(e[t]=n),e)),{});const l="wixui-",s=(e,...t)=>{const n=[];return e&&n.push(`${l}${e}`),t.forEach((e=>{e&&(n.push(`${l}${e}`),n.push(e))})),n.join(" ")};const c=e=>e.replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`)),u=(((e,t,n=[])=>{e.reduce(((e,t)=>({...e,[t]:!0})),{}),n.length})(["isSocialElementsBlocked"],(e=>{let{isSocialElementsBlocked:t}=e;return t?"WithConsentWrapper":void 0})),e=>({consentPolicy:e.currentConsentPolicy,openSettingModal:()=>e.openSettingModal([])}));var d={root:"google-map"};function p(){const t=e.useRef([]);return[e.useCallback((()=>new Promise((e=>t.current.push(e)))),[]),e.useCallback((e=>{t.current.forEach((t=>t(e))),t.current.length=0}),[])]}const f=(e,t)=>{if(e||t)return t?{path:e,fillColor:t,strokeColor:t,fillOpacity:1,scale:.5}:(e=>{if(e&&e.endsWith(".webp"))try{const t=e.match(/media\/[^/]+/)[0].split(".")[1];e=e.replace(/.webp$/,"."+t)}catch(e){}return e})(e)},g=(e,t)=>e.map((e=>({...e,icon:f(e.pinIcon,e.pinColor)||t&&f(t.pinIcon,null==t?void 0:t.pinColor)})));var m="load",v="message",y="SET_INITIAL_LOCATIONS",h="SET_CENTER",E="CENTER_UPDATED",M="SET_ZOOM",S="ZOOM_UPDATED",C="MARKER_CLICKED",w="MAP_CLICKED",b="GET_MARKERS",O="MARKERS",k="FIT_BOUNDS",N="MAP_IDLE",_="OPEN_INFO_WINDOW",I="TILES_LOADED",L="SET_MARKER_ICON",D="SET_MARKER_ICON_FINISHED",R="SET_DIRECTION";const P=["iw","ar","ur","fa"];function x(t,n,o){let{mapData:r,language:i,isEditorMode:l}=n,{onUpdateZoom:s,onUpdateCenter:c,onMarkerClicked:u,onMapClicked:d}=o;const f=(0,e.useRef)([]),x=(0,e.useRef)(null),T=(0,e.useMemo)((()=>{var e,t,n,o;return void 0!==r.defaultLocation?{pinIcon:null!=(e=null==(t=r.locations[r.defaultLocation])?void 0:t.pinIcon)?e:"",pinColor:null!=(n=null==(o=r.locations[r.defaultLocation])?void 0:o.pinColor)?n:""}:void 0}),[r.defaultLocation,r.locations]),[A,j]=p(),[F,G]=p(),[U,W]=p(),[J,K]=p(),[B,Z]=p(),[$,q]=p(),[H,z]=p(),[V,Q]=(0,e.useState)(!1),X=(e,t)=>{const n=x.current;return g(n||e,t)},Y=(0,e.useMemo)((()=>({...r,locations:X(r.locations,T)})),[r,T]),ee=function(t,n){void 0===n&&(n=null);const o=(0,e.useRef)(n);return(0,e.useEffect)((()=>{o.current=t}),[t]),o.current}(Y),te={[E]:e=>null==c?void 0:c(e),[S]:e=>null==s?void 0:s({zoom:e}),[C]:e=>null==u?void 0:u({type:"markerClicked",...e}),[w]:e=>{let{longitude:t,latitude:n,...o}=e;return null==d?void 0:d({type:"mapClicked",location:{longitude:t,latitude:n},...o})},[O]:e=>j(e),[N]:()=>{const e=f.current.shift();null==e||e()},[I]:()=>{V||Q(!0)},[D]:()=>z()},ne={[m]:e=>{let{_sendMessage:t}=e;t({type:y,data:JSON.stringify({...r,locations:X(r.locations)})},{forceSend:!0}),t({type:R,data:JSON.stringify({direction:P.includes(i)?"rtl":"ltr"})})},[v]:e=>{let{event:t}=e;if("string"==typeof t.payload){var n;const{type:e,data:o}=JSON.parse(t.payload);null==(n=te[e])||n.call(te,o)}}},[oe,re]=function(t){let{reducer:n=(()=>({})),iframeLoaded:o}=t;const r=(0,e.useRef)([]),i=(0,e.useRef)(void 0),l=(0,e.useRef)(void 0),s=(0,e.useRef)(void 0),c=(0,e.useCallback)(((e,t)=>{if(i.current&&o||null!=t&&t.forceSend){var n;const t=null==(n=i.current)?void 0:n.contentWindow;return void(null==t||t.postMessage(e,"*"))}if(!i.current||!l.current||!1===o)return void r.current.push(e);const a=i.current.contentWindow;null==a||a.postMessage(e,"*")}),[o]),u=(0,e.useCallback)((()=>{0!==r.current.length&&!1!==o&&(r.current.forEach((e=>c(e))),r.current=[])}),[c,o]),d=(0,e.useCallback)((e=>{if(s.current&&(s.current(),s.current=void 0),!e)return;const t=()=>{l.current=!0,u(),n({type:"load"},c)};e.addEventListener("load",t),i.current=e,s.current=()=>{e.removeEventListener("load",t)}}),[n,c,u]);return(0,e.useEffect)((()=>{o&&u()}),[o,u]),(0,e.useEffect)((()=>{if(!a())return;const e=e=>{var t;e.source&&e.source!==(null==(t=i.current)?void 0:t.contentWindow)||n({type:"message",payload:e.data},c)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}}),[n,c]),[d,c]}({reducer:(e,t)=>{var n;return null==(n=ne[e.type])?void 0:n.call(ne,{event:e,_sendMessage:t})},iframeLoaded:V});return(0,e.useImperativeHandle)(t,(()=>({setMapCenter:(e,t)=>{const n=F();return re({type:h,data:JSON.stringify({longitude:e,latitude:t})}),f.current.push(G),n},fitBounds:e=>{let{north:t,east:n,west:o,south:r}=e;const a=J();return re({type:k,data:JSON.stringify({north:t,east:n,west:o,south:r})}),f.current.push(K),a},setMarkerIcon:e=>{let{locations:t,coordinates:n,iconOptions:o}=e;const r=H();return x.current=t,re({type:L,data:JSON.stringify({...n,iconOptions:o})}),r},setMapZoom:e=>{const t=U();return re({type:M,data:e}),f.current.push(W),t},getVisibleMarkers:()=>{const e=A();return re({type:b}),e},openInfoWindow:e=>{if(!Y.showDirectionsLink){const t=$();return re({type:_,data:JSON.stringify({locationIndex:e})}),f.current.push(q),t}return new Promise((e=>e()))},setMarkers:(e,t)=>{const n=B();return x.current=e,re(JSON.stringify({...Y,locations:g(e,T),openInfoWindow:null==t?void 0:t.openInfoWindow})),f.current.push(Z),n}}))),(0,e.useEffect)((()=>{if(!V||!l)return;const e=!!ee&&(t=Y.locations,n=ee.locations,t.length===n.length&&t.every(((e,t)=>{const o=Object.keys(e);return o.length===Object.keys(n[t]).length&&o.every((o=>"locationLinkAttributes"===o||e[o]===n[t][o]))})));var t,n;re(JSON.stringify({...Y,locations:X(Y.locations,T),shouldKeepMarkers:e}))}),[Y,re,T,V,ee,l]),[oe]}var T={GoogleMapSkin:"c36GfP",googleMapSkin:"c36GfP",mapContainer:"gwyB6z",GoogleMapDefault:"qFjBwF",googleMapDefault:"qFjBwF",GoogleMapSloppy:"D_LINF",googleMapSloppy:"D_LINF",brd:"J8D75x",one:"KH6hFC",two:"Czan88",GoogleMapLiftedShadow:"sp0Pug",googleMapLiftedShadow:"sp0Pug",shd:"gDJxCg",left:"H78pyp",right:"QvNeFb"};const A={GoogleMapLiftedShadow:()=>e.createElement(e.Fragment,null,e.createElement("div",{className:n(T.left,T.shd)}),e.createElement("div",{className:n(T.right,T.shd)})),GoogleMapSloppy:()=>e.createElement(e.Fragment,null,e.createElement("div",{className:n(T.brd,T.one)}),e.createElement("div",{className:n(T.brd,T.two)})),GoogleMapSkin:()=>e.createElement(e.Fragment,null),GoogleMapDefault:()=>e.createElement(e.Fragment,null)};var j=o.p+"media/googleMap.ea5928de.html",F=o.p+"media/google-map.min.ab3130c1.js";const G=e=>e.replace("https://static.parastorage.com/services/","https://editor.wix.com/_partials/"),U=(t,o)=>{const{id:r,className:l,customClassNames:c=[],skin:u,urlQueries:p,mapData:f,translations:g,isConsentPolicyActive:m,onUpdateCenter:v,onUpdateZoom:y,onMarkerClicked:h,onMapClicked:E,onMouseEnter:M,onMouseLeave:S,isDesignerMode:C,isEditorMode:w,language:b,onMapMount:O}=t,k=A[u],N=((e,t)=>{const n=t?G(F):F,o=new URLSearchParams({googleMapsScriptPath:new URL(n).pathname});return a()&&o.append("origin",window.origin),(t?G(j):j)+"?"+e+"&"+o})(p,C),[_,I]=e.useState(!1),[L]=x(o,{mapData:f,isEditorMode:w,language:b},{onUpdateCenter:v,onUpdateZoom:y,onMarkerClicked:h,onMapClicked:E});e.useEffect((()=>{I(!0)}),[N]),e.useEffect((()=>{null==O||O()}),[O]);const D=g.title,R=((e,t)=>e?{}:t)(m,{id:r,className:n(T[u],T.wixIframe,l,s(d.root,...c)),...i(t)});return e.createElement("div",R,_&&e.createElement("wix-iframe",{"data-src":N},e.createElement(k,null),e.createElement("div",{id:"mapContainer_"+r,onMouseEnter:M,onMouseLeave:S,className:T.mapContainer},e.createElement("iframe",{ref:L,title:D,"aria-label":D,"data-src":N,width:"100%",height:"100%",frameBorder:"0",scrolling:"no",allowFullScreen:!0}))))};var W;const J={GoogleMap:{component:e.forwardRef(U),controller:(W=e=>{let{stateValues:t,mapperProps:n}=e;return{...n,...u(t)}},{useComponentProps:(e,t,n)=>{const o=(e=>({...e,updateStyles:t=>{const n=Object.entries(t).reduce(((e,[t,n])=>{return{...e,[(o=t,o.startsWith("--")?t:c(t))]:void 0===n?null:n};var o}),{});e.updateStyles(n)}}))(n);return W({mapperProps:e,stateValues:t,controllerUtils:o})}})}}}(),r}()})); //# sourceMappingURL=https://static.parastorage.com/services/editor-elements-library/dist/thunderbolt/rb_wixui.thunderbolt[GoogleMap].8ec2407f.bundle.min.js.map